package com.atguigu.day07;

import java.util.concurrent.TransferQueue;

public class Test05 {
    public static void main(String[] args) {
        Triangle t1 = new Triangle();
        t1.a = 3;
        t1.b = 4;
        t1.c = 5;
        System.out.println("t1.isRightTriangle()"+t1.isRightTriangle());
        System.out.println("t1.isIsoscelesTriangle()"+t1.isIsoscelesTriangle());
        System.out.println("t1.isEquilateralTriangle()"+t1.isEquilateralTriangle());
        System.out.println("t1.getArea()"+t1.getArea());
        System.out.println("t1.getLength()"+t1.getLength());
        System.out.println("*************************");
        Triangle t2 = new Triangle();
        t2.a = 3;
        t2.b = 3;
        t2.c = 5;
        System.out.println(t2.isRightTriangle());
        System.out.println(t2.isIsoscelesTriangle());
        System.out.println(t2.isEquilateralTriangle());
        System.out.println(t2.getArea());
        System.out.println(t2.getLength());
        System.out.println("*************************");
        Triangle t3 = new Triangle();
        t3.a = 3;
        t3.b = 3;
        t3.c = 3;
        System.out.println(t3.isRightTriangle());
        System.out.println(t3.isIsoscelesTriangle());
        System.out.println(t3.isEquilateralTriangle());
        System.out.println(t3.getArea());
        System.out.println(t3.getLength());
    }
}

class Triangle {
    int a, b, c;

    boolean isRightTriangle() {
        if (pow(a) == pow(b) + pow(c) || pow(b) == pow(c) + pow(a) || pow(c) == pow(b) + pow(a)) {
            return true;
        } else
            return false;
    }

    boolean isIsoscelesTriangle() {
        if (a == b || a == c || b == c) {
            return true;
        } else
            return false;
    }

    boolean isEquilateralTriangle() {
        if (a == b && b == c)
            return true;
        else
            return false;
    }

    double getArea() {
        double d = (a + b + c) / 2;
        return Math.sqrt(d * (d - a) * (d - b) * (d - c));
    }

    double getLength() {
        return a + b + c;
    }

    int pow(int a) {
        return a * a;
    }

}
